﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace TankGameV1._0
{
    abstract class TankObject : GameObject
    {
        //创建一个保存坦克方向图片的数组
        Image[] images = new Image[] { };
        //构造函数
        public TankObject(int x,int y,Image[] images,int speed,int life,Direction dir):
            base(x, y,speed, images[0].Width, images[0].Height, life, dir)
        {
            this.images = images;
        }
        public int BornTime = 0;
        public bool IsMove = false;
        public override void Draw(Graphics g)
        {
            BornTime++;
            if (BornTime % 15 == 0)
            {
                IsMove = true;
            }
            if (IsMove)
            {
                switch (this.Dir)
                {
                    case Direction.Up:
                        g.DrawImage(images[0], this.X, this.Y);
                        break;
                    case Direction.Down:
                        g.DrawImage(images[1], this.X, this.Y);
                        break;
                    case Direction.Left:
                        g.DrawImage(images[2], this.X, this.Y);
                        break;
                    case Direction.Right:
                        g.DrawImage(images[3], this.X, this.Y);
                        break;
                }
            }
        }
        public abstract void Fire();
        public abstract void IsOver();
        public abstract void Born();
    }
}
